/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *    2012 year
 *    Author: Mikhail Khromov aka MikeDM (Mike D'Morto)
 *    E-Mail: mikedmorto@gmail.com
 */

#ifndef DIAWAIT_H
#define DIAWAIT_H

#include <QDialog>
#include <QTimer>
#include <QDebug>
#include <QApplication>
#include <QCloseEvent>
#include <QEvent>

namespace Ui {
    class DiaWait;
}

class DiaWait : public QDialog
{
    Q_OBJECT
public:
    explicit DiaWait(QWidget *parent = 0);
    ~DiaWait();
    // SingleShot
    // запуск в простом режиме с ожиданием по таймауту
    int start(int msec,const QString & title,const QString & text);
    // запуск в режиме без таймаута и работающем в несколько этапов
    int start(const QString &title, const QString &text, const QString &stage);
    // режим работы без скрытия
    void setUnhide(bool state);
    void setHided();
    // запрос на то, был ли timeout
    bool isTimeouted();


private:
    Ui::DiaWait *ui;
    QTimer timer;
    bool isTimeout;
    int time;
    bool isUnhided;
    bool isRet;
    int ret;

    void closeEvent(QCloseEvent *event);
    void keyPressEvent(QKeyEvent *e);

public slots:
    void slotStopOk();
    void slotStopError();
    void slotUpdateStatus(const QString &text,qint64 value,qint64 max);
private slots:
    // TIK
    void slotTik();
    void slotPreReject();

signals:

};

#endif // DIAWAIT_H
